import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/users/login',
    method: 'post',
    data
  })
}


export function register(data) {
  return request({
    url: '/users/register',
    method: 'post',
    data
  })
}


export function getCodeImg() {
  return request({
    url: '/codes',
    method: 'post'
  })
}

export function getInfo(token) {
  return request({
    url: '/users/account',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/users/logout',
    method: 'delete'
  })
}

//删除
export function deleteById(data) {
  return request({
    url: '/users/deleteAccountInfoByIds',
    method: 'post',
    data
  })
}

// 分页
export function getUserPage(data) {
  return request({
    url: '/users/getAccountInfoPage',
    method: 'post',
    data
  })
}

// 获取用户详情
export function getUserDetail(id) {
  return request({
    url: `/users/${id}`,
    method: 'get'
  })
}

//添加用户
export function addUser(data) {
  return request({
    url: `/users`,
    method: 'post',
    data
  })
}



//更新用户
export function updateUser(data) {
  return request({
    url: `/users/updateAccountInfo`,
    method: 'post',
    data
  })
}

